package com.gtw.modules.api.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.gtw.modules.api.service.TbBargainService;
import com.gtw.modules.dao.TbBargainDao;
import com.gtw.modules.entity.TbBargain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service("tbbargainservice")
public class TbBargainServiceImpl implements TbBargainService {


    @Autowired
    private TbBargainDao tbBargainDao;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return tbBargainDao.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TbBargain record) {
        return tbBargainDao.insert(record);
    }

    @Override
    public int insertSelective(TbBargain record) {
        return tbBargainDao.insertSelective(record);
    }

    @Override
    public TbBargain selectByPrimaryKey(Integer id) {
        return tbBargainDao.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TbBargain record) {
        return tbBargainDao.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TbBargain record) {
        return tbBargainDao.updateByPrimaryKey(record);
    }

    @Override
    public Page<TbBargain> queryPageList(Page<TbBargain> page, Map<String, Object> map) {
        page.setRecords(tbBargainDao.queryPageList(page, map));
        return page;
    }

    @Override
    public List<TbBargain> findAll() {
        return tbBargainDao.findAll();
    }

    /**
     * 查询所有未结束发起的砍价信息
     *
     * @return
     * @param oneDay
     */
    @Override
    public List<TbBargain> findNoClose(Date oneDay) {
        return tbBargainDao.findNoClose(oneDay);
    }
}
